﻿@{
    Layout = "~/Areas/PawRoot/Views/Shared/PawRootList.cshtml";
}

<div class="row">
    <div class="col-lg-1"></div>
    <div class="col-lg-3">
        <div class="input-group"><span class="input-group-addon">笔记标题</span><input type="text" class="form-control" id="title" placeholder="请输入标题名..."></div>
    </div>
    <div class="col-lg-3">
        <div class="input-group">
            <span class="input-group-addon">数据状态</span>
            <select class="form-control" id="dataStatus">
                <option value="1">正常数据</option>
                <option value="99">已删数据</option>
            </select>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-lg-1"></div>
    <div class="col-lg-3">
        <div class="input-group"><span class="input-group-addon">开始时间</span><input type="text" class="form-control lot-time" id="startTime" placeholder="请选择开始时间..."></div>
    </div>
    <div class="col-lg-3">
        <div class="input-group"><span class="input-group-addon">结束时间</span><input type="text" class="form-control lot-time" id="endTime" placeholder="请选择结束时间..."></div>
    </div>
</div>
<div class="row">
    <div class="col-lg-4"></div>
    <div class="col-lg-3">
        <div class="btn-group">
            <button class="btn btn-default" type="button"><i class="glyphicon glyphicon-export"></i> 导出</button>
            <button class="btn btn-default" type="button" id="reset"><i class="glyphicon glyphicon-repeat"></i> 重置</button>
            <button class="btn btn-default" type="button" id="search"><i class="glyphicon glyphicon-search"></i> 查询</button>
        </div>
    </div>
</div>

@section JsScript{
    <script type="text/javascript">
        $(document).ready(function () {
            var columns = [{
                field: 'State',
                checkbox: true
            },
            {
                field: 'Id',
                title: '序号',
                align: 'center',
                formatter: function (value, row, index) {  //格式方法
                    if (value) {
                        return value;
                    } else {
                        return index + 1;
                    }
                }
            },
            {
                field: 'NId',
                title: '编号',
                align: 'center',
                sortable: true
            },
            {
                field: 'NTitle',
                title: '标题',
                align: 'center',
                sortable: true
            },
            {
                field: 'NAuthor',
                title: '作者',
                align: 'center',
                sortable: true
            },
            {
                field: 'NHitCount',
                title: '浏览量',
                align: 'center',
                sortable: true
            },
            {
                field: 'NCreateTime',                      //字段名字
                title: '创建时间',                         //标题名字
                align: 'center',                           //对齐方式
                sortable: true,                            //支持排序
                formatter: function (value, row, index) {  //格式方法
                    return getDate(value);
                }
            },
            {
                field: 'NUpdateTime',
                title: '更新时间',
                align: 'center',
                sortable: true,
                formatter: function (value, row, index) {
                    return getDate(value);
                }
            },
            {
                field: 'NPush',
                title: '推送主页',
                align: 'center',
                sortable: true,
                formatter: function (value, row, index) {
                    if (value == true) {
                        return '<font style="color:red;">推送</font>';
                    } else {
                        return '不推';
                    }
                }
            },
            {
                field: 'NDataStatus',
                title: '状态',
                align: 'center',
                formatter: function (value, row, index) {
                    if (value == 99) {
                        return '<font style="color:red">已删</font>'
                    } else {
                        return '正常';
                    }
                }
            },
            {
                title: '单操作',
                align: 'center',
                formatter: function (value, row, index) {
                    return '<a href="#' + row.NId + '" class="edit glyphicon glyphicon-pencil"></a>&nbsp;&nbsp;<a href="#" class="remove glyphicon glyphicon-trash"></a>';
                },
                events: {
                    'click .edit': function (e, value, row, index) {
                        location.href = '/PawRoot/Note/Edit?id=' + row.NId;
                    },
                    'click .remove': function (e, value, row, index) {
                        updateData(row.NId, 99);
                    }
                }
            }
            ];
            initTable(columns);
        });

        //获取选中项Ids（每个表的ID字段不一样，所以得单独定义）
        function getSelectIds() {
            var ids = $.map(lotTab.bootstrapTable('getSelections'), function (row) {
                return row.NId;
            });
            return ids.join(',');
        }
    </script>
}